<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2016/9/20
  Time: 15:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <jsp:include page="../../head.jsp"/>
    <title>待受理页面</title>
    <script type="application/javascript" src="../../js/gtimp3/declaration.js"></script>
    <script type="text/javascript">
        var formSetting = {
            title: "查询信息",
            module: 'query',
            columns: [
                {
                    name: "declaration_type",
                    label: "进出口类型",
                    type: "dropdown",
                    data: [["进口", "I"], ["出口", "E"]],
                    op: "eq",
                    minLength: 0
                }, {
                    name: "contract_no",
                    label: "合同协议号"
                }, {
                    name: "business_Id",
                    label: "业务编号"
                }, {
                    name: "container_no",
                    label: "集装箱号"
                }, {
                    name: "company_co",
                    label: "收发货人",
                    type: "dropdown",
                    dropdownType: "ajax",
                    url: "../order-dropdown/company",
                    op: "eq",
                    minLength: 1,
                    keyWordName: "key",
                    success: function (data) {
                        data = data.results;
                        var array = new Array();
                        $.each(data, function (i, n) {
                            array.push([n["text"], n["value"]]);
                        });
                        return array;
                    }
                }, {
                    name: "bl_no",
                    label: "提运单号"
                }, {
                    name: "confirm_Time",
                    label: "提交时间起",
                    type: "date",
                    op: "ge"
                }, {
                    name: "confirm_Time",
                    label: "提交时间止",
                    type: "date",
                    op: "le"
                }, {
                    name: "customer.COM_NAME",
                    label: "实际托运人"
                }, {
                    name: "is_tongguan_yth",
                    label: "通关一体化",
                    type: "dropdown",
                    data: [["是", "1"], ["否", "0"]],
                    op: "eq",
                    minLength: 0
                }],
            buttons: {
                custom: [{
                    id: "backBtn",
                    value: "返回",
                    click: function () {
                        history.go(-1);
                    }
                }]
            },
            grid: {
                id: "declarationsDataGrid",
                title: "查询结果",
                url: "findToValidList",
                multiselect: true,
                colModel: [{
                    index: "ID",
                    name: "id",
                    hidden: true
                }, {
                    name: "businessId",
                    label: "业务编号",
                    formatter: function (cellvalue, options, rowObject) {
                        return "<a href=\"javascript:;\" onclick=\"javascript:doEditSingle('"
                               + rowObject.id + "','"
                               + rowObject.declaration_type + "',false,'toValid');\">" + cellvalue
                               + "</a>";
                    }
                }, {
                    name: "declarationType",
                    label: "进出口类型",
                    align: "center",
                    formatter: function (val) {
                        return "E" === val ? "出口" : "进口"
                    }
                }, {
                    name: "containerNo",
                    label: "集装箱号"
                }, {
                    name: "blNo",
                    label: "提运单号"
                }, {
                    name: "contractNo",
                    label: "合同协议号"
                }, {
                    name: "companyName",
                    label: "收发货人"
                }, {
                    index: "customer.COM_NAME",
                    name: "customerCompany.comName",
                    label: "实际托运人"
                }, {
                    name: "confirmTime",
                    label: "业务提交时间"
                }, {
                    name: "paymentTime",
                    label: "业务支付时间"
                }, {
                    name: "creator",
                    label: "下单人",
                    formatter: function (cellvalue, options, rowObject) {
                        return "<a href=\"javascript:;\" onclick=\"javascript:showContactWay('"
                               + rowObject.id + "','creator');\">" + cellvalue + "</a>";
                    }
                }, {
                    index: "validator.U_NAME",
                    name: "validator.uName",
                    width: 60,
                    label: "核实人"
                }, {
                    name: "state",
                    label: "业务状态",
                    formatter: function (cellvalue, options, rowObject) {
                        switch (cellvalue) {
                            case "DS00":
                                return "草稿状态";
                            case "DS01":
                                return "待审核";
                            case "DS02":
                                return "已审核";
                            case "DS03":
                                return "驳回";
                            case "DS04":
                                return "已安排";
                            case "DS05":
                                return "放行";
                            case "DS06":
                                return "初审";
                            case "DS07":
                                return "复审";
                            case "DS08":
                                return "现场递单";
                            case "DS09":
                                return "查验";
                            case "DS10":
                                return "海关放行";
                            case "DS11":
                                return "商检放行";
                            default:
                                return "";
                        }
                    }
                }, {
                    name: "isTongguanYth",
                    label: "通过一体化",
                    formatter: function (cellvalue, options, rowObject) {
                        switch (cellvalue) {
                            case "1":
                                return "是";
                            default:
                                return "否";
                        }
                    }
                },{
                    label: "操作",
                    sortable: false,
                    buttons: [{
                        key: "id1",
                        value: "详情",
                        click: function (gridid, rowId, rowdata) {
                            doEditSingle(rowId, rowdata.declaration_type, false, 'toValid');
                        }
                    }],
                    formatter: $.jqGrid.custom.formatter.button
                }],
                sortname: "payment_time",
                sortorder: "asc",
                ondblClickRow: function (rowid, iRow, iCol, e) {
                    if (rowid) {
                        var rowData = $("#declarationsDataGrid").jqGrid("getRowData", rowid);
                        doEditSingle(rowid, rowData.declaration_type, false, 'toValid');
                    }
                }
            }
        };
        $(document).ready(function () {
            $("#declarationsDataTable").mrdForm(formSetting);
        });
    </script>
</head>
<body>
<div id="declarationsDataTable"></div>
</body>
</html>
